(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Children's Library | Biodiversity Heritage Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Arduino"

Garduino Geek Gardening 



.1 



Make Projects 



build, hack, tweak, share, discover^ 



Garduino Geek Gardening 

Written By: Luke Iseman 



PARTS: 

Arduino microcontroller (1) 

Circuit board (1) 

You can pack everything onto a ProtoShield or use a solderless breadboard. 

Relay (2) 

Diode (2) 

Resistor (1) 
for the LED 

LED(1) 

Any you'd use with an Arduino will do. 

Photocell (1) 

Thermistor (1) 

Wire (several feet) 

Resistor (3) 

Galvanized nails (2) 

USB cabled) 

AC extension cords (2) 

Plastic milk jug (1) 

Use as many as you'd like. I used about 30. 

Storage containers (1) 



© Make Projects www.makeprojects.com Page 1 of 14 



Garduino Geek Gardening 

You'll need 1 for every 6 milk jugs. 

Bricks (5 for each container) 

to raise the milk jugs at least 1 " off the bottom of the bin. Youa€™ll need about 5 for 

each storage container. 

Seeds (1) 

preferably for things you'd like to eat. 

• Fluorescent light fixture (1) 

Fluorescent tube grow light (1) 

/ used the OttLite. but any tube marketed for plant growth should be fine. 

Soil mixture (1) 

/ used Mel's Mix, as recommended in Mel Bartholomew's Square Foot Gardening. It 
consists of 1/3 peat moss. 1/3 coarse vermiculite. and 1/3 mixed compost, with the 
mixed compost coming from at least 6 different sources. You can use whatever works 
for your plants. 

Submersible water pump (1) 

/ used a mini submersible pump for clean water. 

Micro soaker hose kit (1) 

Or you can use bike inner tubes and poke holes. 

5-gallon bucket (1) 

Funnel (1) 

/ used a cut milk jug 



SUMMARY 

I wanted to start gardening, but I knew I wouldn't keep up the regular schedule of watering 
the plants and making sure they got enough light. So I recruited a microprocessor and a 
suite of sensors to help with these tasks. An Arduino microcontroller runs my indoor garden, 
watering the plants only when they're thirsty, turning on supplemental lights based on how 
much natural sunlight is received, and alerting me if the temperature drops below a plant- 
healthy level. For sensors, the Garduino uses an inexpensive photocell (light), thermistor 
(temperature), and a pair of galvanized nails (moisture). 

Total cost, including the Arduino, was about $150. 



© Make Projects www.makeprojects.com Page 2 of 14 



Garduino Geek Gardening 

All electronics can be purchased at the Maker Shed and Jameco , and everything else can be 
found at your local hardware store. See http://makezine.eom/1 8/garduino for direct links to 
purchase the parts online. 



Step 1 — Microcontroller Overview 



MICROCONTROLLER INPUTS AND OUTPUTS 

Here's how the Arduino's I/O pins connect 
to the Garduino's sensors, relays, and LED. 



/~ 



SOIL PROBE 



~> 



PHOTOCELL 

♦ 5VDC 



J 




r 

THERMISTOR 


*5VDC 


\ 


ANALOG 2 


Nr3 






> R1 


V 


-4- 


J 



LED 



DIGITAL I/O 2 



KEY 

Rl lOkfi 

R2 Photocell 



R3 Thermistor 
R4 22011 
Dl 1N4004 



""A 






RELAYS 

DIGITAL I/O 7 8 



"I 



0' 



120V 
PLUG 



2\ m 



J 



EXTENSION 
CORD 



L_|-[T] RELAY 

LH rr 



3^ 



J V^ 




• TIP: This project is 
ambitious for a first Arduino 
undertaking. I recommend 
completing at least the first few 
lessons of an Arduino tutorial 
before attempting this. There's a 
great one at 
http://ladyada.net/learn/arduino . 

• WARNING: This project involves 
using electricity near water. We 
recommend connecting to a GFCI 
outlet. 



Step 2 — Plant your garden. 

• Sprout your seeds before planting them, or buy started plants. 

• I planted a variety of vegetables in milk jugs with the tops cut off, with holes in the bottom 
to allow drainage, and a surrounding plastic storage container to catch water as it drained 
out. 



© Make Projects 



www.makeprojects.com 



Page 3 of 14 



Garduino Geek Gardening 



Step 3 — Make moisture sensors. 




• Cut 2 pieces of wire, each 2' long, 
and strip 1/2" off the ends. 

• Wrap 1 end of each wire around the 
head of each nail. 

• Cover the wire-nail connection with 
a generous amount of solder. 



Step 4 — Connect the moisture sensors to the Arduino. 

• You can tell when your soil needs water by measuring the resistance between the 2 nails 
stuck in the dirt. The more water in the soil, the more conductive it is. 

• Connect a wire between ground on your Arduino and the ground (-) column on your 
breadboard. You'll use this column on the breadboard as ground for the rest of the circuit. 

• Connect a wire between +5V on your Arduino and the positive (+) column on your 
breadboard. You'll use this column as the positive voltage connection for the rest of the 
circuit. 

• Connect one of the moisture sensors to +5V on the breadboard. 

• Connect the other moisture sensor to a new row on the breadboard. 

• Connect a 10kQ resistor to the same row as the moisture sensor and also to a new row. 

• Connect a wire from analog input on your Arduino to the same row as the resistor and 
moisture sensor. 

• Connect the other end of the resistor (in the new row) to ground. 



© Make Projects 



www.makeprojects.com 



Page 4 of 14 



Garduino Geek Gardening 



Step 5 — Load the sensor test code. 

• Make sure that the moisture sensor works by connecting your Arduino to a computer and 
entering the sensor test code at http://makezine.com/18/garduino . When you touch the 
nails together, the moisture value should read -985; when they're not touching, the 
moisture value should be 0. 

• NOTE: If you haven't used your Arduino before, you need to connect it via its USB 
cable to your computer, then launch the Arduino development application (free 
download at http://arduino.cc ), enter the code, and then upload it to the board. Select the 
serial monitor to see the output. 



© Make Projects www.makeprojects.com Page 5 of 14 



Garduino Geek Gardening 



Step 6 — Add the light sensor. 



Q leess03selaaB3sxgsg< 




09 K 



st or 



■5E OE 



• First, connect the photocell to 2 
new rows on the breadboard. 

• Connect a wire between one row 
that the photocell touches and the 
positive column. 

• Connect a 10kn resistor to the 
other row that the photocell 
touches and to a new row. 

• Connect a wire between the 
photocell-resistor row and analog 
input 1 on your Arduino. 

• Connect the other end of the 
resistor to ground. 

• Test your light sensor by 
connecting your Arduino to your 
computer and monitoring the serial 
output. I measured the following 
values: 

• Indirect sun: 949 

• Ambient indoor light at night: 658 

• Ambient indoor light at night, 
with a hand casting shadow over 
the sensor: 343 



© Make Projects 



www.makeprojects.com 



Page 6 of 14 



Garduino Geek Gardening 



Step 7 — Connect the temperature sensor. 



O igosssassioseQaaaei 



tsa!=s»> 




w&* 



at n m 



• Connect the thermistor to 2 new 
rows on the breadboard. 

• Connect a wire between one row 
that the thermistor touches and to 
the positive column. 

• Connect the last of the ^0kQ. 
resistors to the other row the 
thermistor touches and to a new 
row. 

• Connect a wire between the 
thermistor-resistor row and analog 
input 2 on your Arduino. 

• Connect the other end of the 
resistor to ground. 

• Test your temperature sensor by 
connecting your Arduino to your 
computer and monitoring the serial 
output. I measured the following 
values: 

• 61°F = 901 

• 90°F = 949 

• 51°F = 877 

• 32°F = 796 



© Make Projects 



www.makeprojects.com 



Page 7 of 14 



Garduino Geek Gardening 



Step 8 — Splice relays into the light/pump power cords. 




• Now we work with the heavy lifters: our relay setups. These will turn the lights and pumps 
on and off, in response to hours of sunlight received and soil moisture. 

• Cut four 10" lengths of 22-gauge wire and strip 1/2" off each end. 

• Look at your extension cord's plug: one prong is larger than the other. Split the 2 wires of 
the cord apart, then cut the wire that runs to the smaller prong, and strip 1" off each side. 

• TIP: The correct wire is the one without ridges running along its length. Don't worry 
if you cut both wires; you can just splice the other wire back together. 

• Solder a 22-gauge wire to each side of the split cord wire. 

• Solder the 22-gauge wire that runs to the extension cord's receptacle to the lower right 
lead of the relay (it should be labeled "4" on the bottom of the relay). 

• Solder the 22-gauge wire that runs to the extension cord's plug to the middle left lead of 
the relay (labeled "1"). 

• Connect a 22-gauge wire to each of the 2 other leads on the left side of the relay (labeled 
"2" and "5"). Optionally, you can cover the relay's bottom side with hot glue to strengthen 
all 4 connections. 

• Wrap both connections to the extension cord in electrical tape or heat-shrink tubing. 
Congratulations, you've completed your relay-cord setup. 

• Repeat the steps above with another relay and extension cord to create the second relay- 
cord setup. 



© Make Projects 



www.makeprojects.com 



Page 8 of 14 



Garduino Geek Gardening 

Step 9 — Connect the relays and an LED to the Arduino. 

• Connect one of your diodes to 2 unused rows on the breadboard. 

• Connect the bottom left lead (pin 2) of your relay (looking at it from the top, with the leads 
down) to the positive lead of your diode — the end that does not have a band on it. 

• Connect the upper left lead (pin 5) of your relay to the negative lead of the diode — the end 
marked with a band. 

• Connect a wire between ground on your Arduino and the ground column on your 
breadboard (if you're using the same breadboard for relays and sensors, just use the 
ground column you've already created). 

• Connect the row containing the negative lead of your diode (the end with the band) and the 
upper left lead of your relay to digital input/output 7 on your Arduino. 

• Connect the positive lead of the diode to your ground column. That's it for connecting the 
first relay. 

• Now choose 2 new unused rows and repeat the steps above to connect the second diode 
and relay as you did the first, except this one goes to digital input/output 8 on your 
Arduino. 

• Connect the 220Q. resistor to 2 unused rows. Connect the LED's long leg (+) to either end 
of the resistor, and its short leg (-) to ground. Connect the other end of the resistor to 
digital input/output 2 on your Arduino. 



© Make Projects www.makeprojects.com Page 9 of 14 



Garduino Geek Gardening 



Step 10 — Set up the lighting system. 




• An easy step here: after checking 
that your light fixture is working, 
plug it into the relay cord that will 
control it. 

• I simply rested the fixture on top of 
the outer plastic bins, but feel free 
to get fancy. 

• Optimum distance from these 
fluorescents for the light intensity 
you want is just a few inches, so 
make sure you get them up close, 
personal, and adjustable as the 
plants grow. 



© Make Projects 



www.makeprojects.com 



Page 10 of 14 



Garduino Geek Gardening 



Step 11 — Set up the watering system. 




• You've got a wide variety of options here. Here's how mine works: 

• A small pump is submerged in a 5gal bucket water source. 

• A relay controlled by moisture sensors activates the pump to move water from the bucket 
to a milk-jug funnel. 

• Gravity moves water from the funnel down to the soaker hoses, which drip into the plants. 

• I used a mini soaker hose kit from Harbor Freight Tools to assemble rings that drip into all 
the plant containers. If you make a setup like this, be sure to elevate the bucket on a crate 
or something else; moving water inches instead of feet vertically will greatly reduce the 
strain on your pump. 

• I initially tried using just a sprinkler valve mounted to the bottom of a bucket, without the 
pump. But gravity provided only enough pressure for the slightest trickle. I thought about 
connecting the sprinkler valve right into my plumbing, but I worried that the chlorine 
content of water straight from the faucet would be bad for my plants (chlorine evaporates 
from water within something like 24 hours). 

• A better version of this would be to use 2 buckets, with water coming from a sprinkler 
valve connected to house plumbing going into one bucket, being held there 24-plus hours, 
and then moving into the second, plant-feeding bucket. 



© Make Projects 



www.makeprojects.com 



Page 11 of 14 



Garduino Geek Gardening 



Step 12 — Program your Garduino. 



mm*im.mmn 



JBJJSI 



Ffe Edi 5tetd> Toot Help 



©0 iiiEB 



[//1: 1 .- i'.iu-; tbC Jitetii:e library,, so our tfartiumo can keep tract oE JljS 
fmclude <BateTiue.h> 

//define analog snputs to which ae have connected our s«issor3 _ 

LAC apistuteS$n3P5 ■ 9; 
DUE liffhtSftrta*!: » 1; 
int tenpSenaor - 2; 

//define digital outputs to which ve have connecte our relays (u^te 
int waterPMnp * 7; 
lM linhtSmtch - 8; 
Lnc twptcd ■ 2: 

//define variables to store nOistuire, light, and tcBpecatute value 
t&C aioifttute vftl; 
lnt li(fht_vel; 
tax «*.p_val; 

//decide how aonv hours of lipht your plants should c/ct daily 
float hvui3_light_daily_desii:ed - Id; 

<i i 





• Lastly, you need to program your 
Garduino to run the garden. 
Because temperature and soil 
moisture are dealt with as 
constants (i.e., always turn on the 
LED if temperature is below a 
certain value, always turn on the 
water if moisture is below a certain 
value) they're simple to deal with. 

• Light is more complicated: you 
want to keep track of how much 
light your plants are getting, so that 
natural light plus supplemental light 
always equals optimum light time 
(in my case, I chose 14 hours 
daily). To do this, I used the 
DateTime Arduino library. 



© Make Projects 



www.makeprojects.com 



Page 12 of 14 



Garduino Geek Gardening 

Step 13 — Switching to Gardening Computer 

• Reap Your Harvest 

• Check your seed packets (you saved them, right?) to see how many weeks until your 
plants should be ready for harvest. But don't be surprised if they're ready sooner than that! 
If they seem to be growing too slowly, check your watering and lighting routines. 

• Evaluate Your Data 

• As currently implemented, Garduino needs to be hooked up to a computer that's 
monitoring serial output to obtain more meaningful data to share. With additional work, it's 
possible to store data on a USB drive. But for now, monitor the serial output in the Arduino 
environment to evaluate your Garduino's performance. 

• Improve Away! 

• I don't expect this beta Garduino to get everyone gardening and save the world; that's an 
exercise for readers to solve with their improvements. But here are some initial ideas: 

• Use pulsing red and blue LEDs for an ultra-efficient lighting system (see 
http://screwdecaf.cx/sept.html for Mikey Sklar's version). 

• Figure out what times of night your utility charges lower rates for electricity, and turn the 
lights on during those times only. 

• Build a pH probe and fine-tune your soil acidity for different plants. 

• Add a relay-controlled heater to keep a greenhouse version above a minimum desired 
temperature. 

• Add a battery and solar panel to take the whole system off-grid. 

• Use an irrigation valve instead of a pump to water your larger, outdoor garden, and add 
some modified solar garden lights for additional lighting. 

• If many people start recording the efficiency and convenience of this automated approach 
to gardening, then maybe we can even grow more food of better quality with less energy. 
Happy Garduino-ing! 

• You can find the complete code at http://www.makezine.com/18/qarduino . I'll add links to 
better versions as readers create them. 



This project first appeared in MAKE Volume 18 . page 90.'" 



Related Posts on Make: Online: 



© Make Projects www.makeprojects.com Page 13 of 14 



Garduino Geek Gardening 

Android- Powered Garduino Remote Control 
http://blog.makezine.com/archive/201 0/03. .. 
Original post: Gardening + Arduino = Garduino 
http://blog.makezine.eom/archive/2008/1 2. .. 

This document was last generated on 2012-10-31 12:57:23 AM. 



© Make Projects www.makeprojects.com Page 14 of 14